<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="initial-scale=1.0, user-scalable=no, width=device-width">
<title>地图</title>
<link rel="stylesheet"
	href="http://cache.amap.com/lbs/static/main1119.css" />
<link type="text/css" rel="stylesheet" href="../css/public/public.css">
<style type="text/css">
.winclose {
	color: #c8c8c8;
	margin-left: 10px;
	text-decoration: none;
    outline: 0;
    position: absolute;
    top: 13px;
    right: 19px;
}
.topbar{
	position: absolute;
    width: 900px;
    height: 39px;
    border-bottom: 1px solid #c8c8c8;
    -webkit-user-select: none;
    background-color: #FDFDFD;
    cursor: default;
}
</style>

<script src="../js/compatible.js"></script>
</head>
<body style="width: 900px; height: 600px;overflow: hidden" oncontextmenu="return false" style="-webkit-user-select: none;">
	<div id="topbar" class="login-close topbar">
		<a id="winClose" href="javascript:;" class="iconn-11 winclose"></a>
	</div>
	<div id="container" style="top: 40px; height: 560px;"></div>
	<script src="../js/jquery.min.js"></script>
	<script src="../js/qwebchannel.js"></script>
	<script type="text/javascript"
		src="https://webapi.amap.com/maps?v=1.3&key=ce59f4a6bbf4d4c644a3b6dd6d2105aa"></script>
	<script>
		$(function() {
			new QWebChannel(qt.webChannelTransport, function(channel) {

				window.mapObject = channel.objects.qMsgMap;
				window.publicObject = channel.objects.qWebPublicObj;

				console.log(mapObject);

				mapObject.onHtmlReady();

				mapObject.getMapTransparentInit(function(data) {
					console.log(data);
					var map = new AMap.Map('container', {
						zoom : 15,
						center : [ data.x, data.y ]
					});
					AMap.plugin([ 'AMap.ToolBar', 'AMap.Scale' ], function() {
						map.addControl(new AMap.ToolBar());

						map.addControl(new AMap.Scale());

					});

					marker = new AMap.Marker({
						position : [ data.x, data.y],
						title : data.positionName
					});

					marker.setMap(map);
				});

				$('#winClose').on('click',function(){
					clearTimeout(timer_);
					publicObject.closeGeneralDlg(104);
				});
				
				$('#winClose').on('mouseover',function(){
					timer_ = setTimeout(function(){
						publicObject.setTip('关闭');
					},800);
				}).on('mouseout',function(){
					window.clearTimeout(timer_);
					publicObject.hideTip();
				});
				
				//窗口拖动
				$('#topbar').mousedown(function(e){
					if(e.which == 1){
						mapObject.startMove(e.screenX, e.screenY); 
					}
				}).mouseup(function(e){
					if(e.which == 1){
						mapObject.stopMove();
					}
				});
				
				$('#winClose').mousedown(function(e){
					e.stopPropagation();
				}).mouseup(function(e){
					e.stopPropagation();
				});
				
			});
		})
	</script>

</body>
</html>